function SuperType(name) {
  this.name = name
  this.colors = ['red', 'green', 'blue']
}
SuperType.prototype.sayName = function () {
  console.log(this.name);
}


// 创建超类原型的副本
let anotherPrototype = Object.create(SuperType.prototype)
anotherPrototype.constructor = SubType


function SubType(name, age) {
  SuperType.call(this, name)
  this.age = age
}

SubType.prototype = anotherPrototype

SubType.prototype.sayAge = function () {
  console.log(this.age);
}



var instance1 = new SubType('kk', 18)
var instance2 = new SubType('ov', 20)

instance1.colors.push('pink')
console.log(instance1.colors);
instance1.sayName()
instance1.sayAge()


console.log(instance2.colors);
instance2.sayName()
instance2.sayAge()
